package com.starters.redisson.config;


import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;

import javax.annotation.PostConstruct;
import java.util.logging.Logger;

/**
 * TODO: redisson自动装配的配置类
 *
 * @author wuyijie
 * @date 2022/2/13 12:18 AM
 */
@Data
@ConfigurationProperties(prefix = CustomizedRedissonProperties.PREFIX)
public class CustomizedRedissonProperties {
    private static final Logger LOGGER = Logger.getLogger(CustomizedRedissonProperties.class.getName());

    private boolean enable = true;
    public static final String PREFIX = "commom.redisson";

    /**
     * 分布式锁持有锁的超时时间
     */
    private Long timeout = 10000L;

    /**
     * 分布式锁获取锁的超时时间
     */
    private Long tryTimeout = 10000L;


    @PostConstruct
    void initialize() {
        LOGGER.info(String.format("<<  RedissonProperties初始化完成：%s  >>", this.toString()));
    }

}
